/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.ana.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lucas.nunes
 */
@Entity
@Table(name = "QLTTB_STATUS_QUALIFICACAO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "StatusQualificacao.findAll", query = "SELECT s FROM StatusQualificacao s"),
    @NamedQuery(name = "StatusQualificacao.findByStqId", query = "SELECT s FROM StatusQualificacao s WHERE s.stqId = :stqId"),
    @NamedQuery(name = "StatusQualificacao.findByStqNm", query = "SELECT s FROM StatusQualificacao s WHERE s.stqNm = :stqNm"),
    @NamedQuery(name = "StatusQualificacao.findByStqDs", query = "SELECT s FROM StatusQualificacao s WHERE s.stqDs = :stqDs")})
public class StatusQualificacao implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "STQ_ID")
    private BigDecimal stqId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 104)
    @Column(name = "STQ_NM")
    private String stqNm;
    @Size(max = 4000)
    @Column(name = "STQ_DS")
    private String stqDs;
    @JoinColumn(name = "STQ_LSQ_ID", referencedColumnName = "LSQ_ID")
    @ManyToOne(optional = false)
    private LimStatusQualificacao stqLsqId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "mdhStqId")
    private List<MedHidrometeorologica> medHidrometeorologicaList;

    public StatusQualificacao() {
    }

    public StatusQualificacao(BigDecimal stqId) {
        this.stqId = stqId;
    }

    public StatusQualificacao(BigDecimal stqId, String stqNm) {
        this.stqId = stqId;
        this.stqNm = stqNm;
    }

    public BigDecimal getStqId() {
        return stqId;
    }

    public void setStqId(BigDecimal stqId) {
        this.stqId = stqId;
    }

    public String getStqNm() {
        return stqNm;
    }

    public void setStqNm(String stqNm) {
        this.stqNm = stqNm;
    }

    public String getStqDs() {
        return stqDs;
    }

    public void setStqDs(String stqDs) {
        this.stqDs = stqDs;
    }

    public LimStatusQualificacao getStqLsqId() {
        return stqLsqId;
    }

    public void setStqLsqId(LimStatusQualificacao stqLsqId) {
        this.stqLsqId = stqLsqId;
    }

    @XmlTransient
    public List<MedHidrometeorologica> getMedHidrometeorologicaList() {
        return medHidrometeorologicaList;
    }

    public void setMedHidrometeorologicaList(List<MedHidrometeorologica> medHidrometeorologicaList) {
        this.medHidrometeorologicaList = medHidrometeorologicaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (stqId != null ? stqId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof StatusQualificacao)) {
            return false;
        }
        StatusQualificacao other = (StatusQualificacao) object;
        if ((this.stqId == null && other.stqId != null) || (this.stqId != null && !this.stqId.equals(other.stqId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.gov.ana.service.StatusQualificacao[ stqId=" + stqId + " ]";
    }
    
}
